<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>DateTime</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            DateTime 
            
                <span class="parent">&lt; 
                    
                    <a href="Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/date_time/acts_like_rb.html">activesupport/lib/active_support/core_ext/date_time/acts_like.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/date_time/calculations_rb.html">activesupport/lib/active_support/core_ext/date_time/calculations.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/date_time/conversions_rb.html">activesupport/lib/active_support/core_ext/date_time/conversions.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/date_time/zones_rb.html">activesupport/lib/active_support/core_ext/date_time/zones.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/json/encoding_rb.html">activesupport/lib/active_support/json/encoding.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>#</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-3C-3D-3E">&lt;=&gt;</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>A</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-acts_like_date-3F">acts_like_date?</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-acts_like_time-3F">acts_like_time?</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-advance">advance</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-ago">ago</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-at_beginning_of_day">at_beginning_of_day</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-at_beginning_of_hour">at_beginning_of_hour</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-at_beginning_of_minute">at_beginning_of_minute</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-at_end_of_day">at_end_of_day</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-at_end_of_hour">at_end_of_hour</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-at_end_of_minute">at_end_of_minute</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-at_midnight">at_midnight</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>B</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-beginning_of_day">beginning_of_day</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-beginning_of_hour">beginning_of_hour</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-beginning_of_minute">beginning_of_minute</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-change">change</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-c-civil_from_format">civil_from_format</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-c-current">current</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-default_inspect">default_inspect</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-end_of_day">end_of_day</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-end_of_hour">end_of_hour</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-end_of_minute">end_of_minute</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>F</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-formatted_offset">formatted_offset</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-future-3F">future?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>G</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-getutc">getutc</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-in">in</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-in_time_zone">in_time_zone</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-inspect">inspect</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>L</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-c-local_offset">local_offset</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>M</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-midnight">midnight</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>P</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-past-3F">past?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>R</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-readable_inspect">readable_inspect</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-seconds_since_midnight">seconds_since_midnight</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-seconds_until_end_of_day">seconds_until_end_of_day</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-since">since</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-to_default_s">to_default_s</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-to_f">to_f</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-to_formatted_s">to_formatted_s</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-to_i">to_i</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-to_s">to_s</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>U</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="DateTime.html#method-i-utc">utc</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-utc-3F">utc?</a>,
              </li>
            
              
              <li>
                <a href="DateTime.html#method-i-utc_offset">utc_offset</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-civil_from_format">
            
              <b>civil_from_format</b>(utc_or_local, year, month=1, day=1, hour=0, min=0, sec=0)
            
            <a href="DateTime.html#method-c-civil_from_format" name="method-c-civil_from_format" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns <a href="DateTime.html">DateTime</a> with local offset for given
year if format is local else offset is zero.</p>

<pre class="ruby"><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil_from_format</span> :<span class="ruby-identifier">local</span>, <span class="ruby-value">2012</span>
<span class="ruby-comment"># =&gt; Sun, 01 Jan 2012 00:00:00 +0300</span>
<span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil_from_format</span> :<span class="ruby-identifier">local</span>, <span class="ruby-value">2012</span>, <span class="ruby-value">12</span>, <span class="ruby-value">17</span>
<span class="ruby-comment"># =&gt; Mon, 17 Dec 2012 00:00:00 +0000</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-civil_from_format_source')" id="l_method-c-civil_from_format_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/794a70f94485fb64ed1c49ba8532895306e2001c/activesupport/lib/active_support/core_ext/date_time/conversions.rb#L63" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-civil_from_format_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/conversions.rb, line 63</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">civil_from_format</span>(<span class="ruby-identifier">utc_or_local</span>, <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>=<span class="ruby-number">1</span>, <span class="ruby-identifier">day</span>=<span class="ruby-number">1</span>, <span class="ruby-identifier">hour</span>=<span class="ruby-number">0</span>, <span class="ruby-identifier">min</span>=<span class="ruby-number">0</span>, <span class="ruby-identifier">sec</span>=<span class="ruby-number">0</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">utc_or_local</span>.<span class="ruby-identifier">to_sym</span> <span class="ruby-operator">==</span> <span class="ruby-value">:local</span>
    <span class="ruby-identifier">offset</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>).<span class="ruby-identifier">utc_offset</span>.<span class="ruby-identifier">to_r</span> <span class="ruby-operator">/</span> <span class="ruby-number">86400</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">offset</span> = <span class="ruby-number">0</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">civil</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">offset</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-current">
            
              <b>current</b>()
            
            <a href="DateTime.html#method-c-current" name="method-c-current" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns <code>Time.zone.now.to_datetime</code> when <code>Time.zone</code>
or <code>config.time_zone</code> are set, otherwise returns
<code>Time.now.to_datetime</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-current_source')" id="l_method-c-current_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L15" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-current_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 15</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">current</span>
  <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span> <span class="ruby-operator">?</span> <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_datetime</span> <span class="ruby-operator">:</span> <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_datetime</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-local_offset">
            
              <b>local_offset</b>()
            
            <a href="DateTime.html#method-c-local_offset" name="method-c-local_offset" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p><strong>DEPRECATED</strong>: Use <code>DateTime.civil_from_format</code>
directly.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-local_offset_source')" id="l_method-c-local_offset_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L6" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-local_offset_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 6</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">local_offset</span>
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">warn</span> <span class="ruby-string">'DateTime.local_offset is deprecated. Use DateTime.civil_from_format directly.'</span>

  <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(<span class="ruby-number">2012</span>).<span class="ruby-identifier">utc_offset</span>.<span class="ruby-identifier">to_r</span> <span class="ruby-operator">/</span> <span class="ruby-number">86400</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-3C-3D-3E">
            
              <b>&lt;=&gt;</b>(other)
            
            <a href="DateTime.html#method-i-3C-3D-3E" name="method-i-3C-3D-3E" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Layers additional behavior on DateTime#&lt;=&gt; so that <a
href="Time.html">Time</a> and <a
href="ActiveSupport/TimeWithZone.html">ActiveSupport::TimeWithZone</a>
instances can be compared with a <a href="DateTime.html">DateTime</a>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-3C-3D-3E_source')" id="l_method-i-3C-3D-3E_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L160" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-3C-3D-3E_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 160</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-keyword ruby-title">other</span>)
  <span class="ruby-keyword">super</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">to_datetime</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-acts_like_date-3F">
            
              <b>acts_like_date?</b>()
            
            <a href="DateTime.html#method-i-acts_like_date-3F" name="method-i-acts_like_date-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Duck-types as a Date-like class. See <a
href="Object.html#method-i-acts_like-3F">Object#acts_like?</a>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-acts_like_date-3F_source')" id="l_method-i-acts_like_date-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/609c1988d2e274b365c5299cc5933fb6855e4175/activesupport/lib/active_support/core_ext/date_time/acts_like.rb#L5" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-acts_like_date-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/acts_like.rb, line 5</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">acts_like_date?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-acts_like_time-3F">
            
              <b>acts_like_time?</b>()
            
            <a href="DateTime.html#method-i-acts_like_time-3F" name="method-i-acts_like_time-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Duck-types as a Time-like class. See <a
href="Object.html#method-i-acts_like-3F">Object#acts_like?</a>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-acts_like_time-3F_source')" id="l_method-i-acts_like_time-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/609c1988d2e274b365c5299cc5933fb6855e4175/activesupport/lib/active_support/core_ext/date_time/acts_like.rb#L10" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-acts_like_time-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/acts_like.rb, line 10</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">acts_like_time?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-advance">
            
              <b>advance</b>(options)
            
            <a href="DateTime.html#method-i-advance" name="method-i-advance" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Uses <a href="Date.html">Date</a> to provide precise <a
href="Time.html">Time</a> calculations for years, months, and days. The
<code>options</code> parameter takes a hash with any of these keys:
<code>:years</code>, <code>:months</code>, <code>:weeks</code>,
<code>:days</code>, <code>:hours</code>, <code>:minutes</code>,
<code>:seconds</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-advance_source')" id="l_method-i-advance_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L72" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-advance_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 72</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">advance</span>(<span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">d</span> = <span class="ruby-identifier">to_date</span>.<span class="ruby-identifier">advance</span>(<span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">datetime_advanced_by_date</span> = <span class="ruby-identifier">change</span>(<span class="ruby-value">:year</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">year</span>, <span class="ruby-value">:month</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">month</span>, <span class="ruby-value">:day</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">day</span>)
  <span class="ruby-identifier">seconds_to_advance</span> =        <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:seconds</span>, <span class="ruby-number">0</span>) <span class="ruby-operator">+</span>
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:minutes</span>, <span class="ruby-number">0</span>) * <span class="ruby-number">60</span> <span class="ruby-operator">+</span>
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:hours</span>, <span class="ruby-number">0</span>) * <span class="ruby-number">3600</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">seconds_to_advance</span>.<span class="ruby-identifier">zero?</span>
    <span class="ruby-identifier">datetime_advanced_by_date</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">datetime_advanced_by_date</span>.<span class="ruby-identifier">since</span> <span class="ruby-identifier">seconds_to_advance</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-ago">
            
              <b>ago</b>(seconds)
            
            <a href="DateTime.html#method-i-ago" name="method-i-ago" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="DateTime.html">DateTime</a> representing the time a
number of seconds ago. Do not use this method in combination with x.months,
use months_ago instead!</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-ago_source')" id="l_method-i-ago_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L89" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-ago_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 89</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">ago</span>(<span class="ruby-identifier">seconds</span>)
  <span class="ruby-identifier">since</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">seconds</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-at_beginning_of_day">
            
              <b>at_beginning_of_day</b>()
            
            <a href="DateTime.html#method-i-at_beginning_of_day" name="method-i-at_beginning_of_day" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-at_beginning_of_hour">
            
              <b>at_beginning_of_hour</b>()
            
            <a href="DateTime.html#method-i-at_beginning_of_hour" name="method-i-at_beginning_of_hour" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-at_beginning_of_minute">
            
              <b>at_beginning_of_minute</b>()
            
            <a href="DateTime.html#method-i-at_beginning_of_minute" name="method-i-at_beginning_of_minute" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-at_end_of_day">
            
              <b>at_end_of_day</b>()
            
            <a href="DateTime.html#method-i-at_end_of_day" name="method-i-at_end_of_day" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-at_end_of_hour">
            
              <b>at_end_of_hour</b>()
            
            <a href="DateTime.html#method-i-at_end_of_hour" name="method-i-at_end_of_hour" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-at_end_of_minute">
            
              <b>at_end_of_minute</b>()
            
            <a href="DateTime.html#method-i-at_end_of_minute" name="method-i-at_end_of_minute" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-at_midnight">
            
              <b>at_midnight</b>()
            
            <a href="DateTime.html#method-i-at_midnight" name="method-i-at_midnight" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-beginning_of_day">
            
              <b>beginning_of_day</b>()
            
            <a href="DateTime.html#method-i-beginning_of_day" name="method-i-beginning_of_day" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="DateTime.html">DateTime</a> representing the start
of the day (0:00).</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-midnight">midnight</a>, <a href="DateTime.html#method-i-at_midnight">at_midnight</a>, <a href="DateTime.html#method-i-at_beginning_of_day">at_beginning_of_day</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-beginning_of_day_source')" id="l_method-i-beginning_of_day_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L102" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-beginning_of_day_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 102</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">beginning_of_day</span>
  <span class="ruby-identifier">change</span>(<span class="ruby-value">:hour</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-number">0</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-beginning_of_hour">
            
              <b>beginning_of_hour</b>()
            
            <a href="DateTime.html#method-i-beginning_of_hour" name="method-i-beginning_of_hour" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="DateTime.html">DateTime</a> representing the start
of the hour (hh:00:00).</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-at_beginning_of_hour">at_beginning_of_hour</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-beginning_of_hour_source')" id="l_method-i-beginning_of_hour_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L116" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-beginning_of_hour_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 116</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">beginning_of_hour</span>
  <span class="ruby-identifier">change</span>(<span class="ruby-value">:min</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-number">0</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-beginning_of_minute">
            
              <b>beginning_of_minute</b>()
            
            <a href="DateTime.html#method-i-beginning_of_minute" name="method-i-beginning_of_minute" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="DateTime.html">DateTime</a> representing the start
of the minute (hh:mm:00).</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-at_beginning_of_minute">at_beginning_of_minute</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-beginning_of_minute_source')" id="l_method-i-beginning_of_minute_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L128" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-beginning_of_minute_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 128</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">beginning_of_minute</span>
  <span class="ruby-identifier">change</span>(<span class="ruby-value">:sec</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-number">0</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-change">
            
              <b>change</b>(options)
            
            <a href="DateTime.html#method-i-change" name="method-i-change" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="DateTime.html">DateTime</a> where one or more of the
elements have been changed according to the <code>options</code> parameter.
The time options (<code>:hour</code>, <code>:min</code>, <code>:sec</code>)
reset cascadingly, so if only the hour is passed, then minute and sec is
set to 0. If the hour and minute is passed, then sec is set to 0. The
<code>options</code> parameter takes a hash with any of these keys:
<code>:year</code>, <code>:month</code>, <code>:day</code>,
<code>:hour</code>, <code>:min</code>, <code>:sec</code>,
<code>:offset</code>, <code>:start</code>.</p>

<pre class="ruby"><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2012</span>, <span class="ruby-value">8</span>, <span class="ruby-value">29</span>, <span class="ruby-value">22</span>, <span class="ruby-value">35</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">change</span>(<span class="ruby-identifier">day</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>)              <span class="ruby-comment"># =&gt; DateTime.new(2012, 8, 1, 22, 35, 0)</span>
<span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2012</span>, <span class="ruby-value">8</span>, <span class="ruby-value">29</span>, <span class="ruby-value">22</span>, <span class="ruby-value">35</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">change</span>(<span class="ruby-identifier">year</span><span class="ruby-operator">:</span> <span class="ruby-value">1981</span>, <span class="ruby-identifier">day</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>)  <span class="ruby-comment"># =&gt; DateTime.new(1981, 8, 1, 22, 35, 0)</span>
<span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2012</span>, <span class="ruby-value">8</span>, <span class="ruby-value">29</span>, <span class="ruby-value">22</span>, <span class="ruby-value">35</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">change</span>(<span class="ruby-identifier">year</span><span class="ruby-operator">:</span> <span class="ruby-value">1981</span>, <span class="ruby-identifier">hour</span><span class="ruby-operator">:</span> <span class="ruby-value">0</span>) <span class="ruby-comment"># =&gt; DateTime.new(1981, 8, 29, 0, 0, 0)</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-change_source')" id="l_method-i-change_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L55" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-change_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 55</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">change</span>(<span class="ruby-identifier">options</span>)
  <span class="ruby-operator">::</span><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:year</span>, <span class="ruby-identifier">year</span>),
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:month</span>, <span class="ruby-identifier">month</span>),
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:day</span>, <span class="ruby-identifier">day</span>),
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:hour</span>, <span class="ruby-identifier">hour</span>),
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:min</span>, <span class="ruby-identifier">options</span>[<span class="ruby-value">:hour</span>] <span class="ruby-operator">?</span> <span class="ruby-number">0</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">min</span>),
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:sec</span>, (<span class="ruby-identifier">options</span>[<span class="ruby-value">:hour</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:min</span>]) <span class="ruby-operator">?</span> <span class="ruby-number">0</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">sec</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">sec_fraction</span>),
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:offset</span>, <span class="ruby-identifier">offset</span>),
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:start</span>, <span class="ruby-identifier">start</span>)
  )
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-default_inspect">
            
              <b>default_inspect</b>()
            
            <a href="DateTime.html#method-i-default_inspect" name="method-i-default_inspect" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-end_of_day">
            
              <b>end_of_day</b>()
            
            <a href="DateTime.html#method-i-end_of_day" name="method-i-end_of_day" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="DateTime.html">DateTime</a> representing the end of
the day (23:59:59).</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-at_end_of_day">at_end_of_day</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-end_of_day_source')" id="l_method-i-end_of_day_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L110" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-end_of_day_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 110</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">end_of_day</span>
  <span class="ruby-identifier">change</span>(<span class="ruby-value">:hour</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-number">23</span>, <span class="ruby-value">:min</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-number">59</span>, <span class="ruby-value">:sec</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-number">59</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-end_of_hour">
            
              <b>end_of_hour</b>()
            
            <a href="DateTime.html#method-i-end_of_hour" name="method-i-end_of_hour" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="DateTime.html">DateTime</a> representing the end of
the hour (hh:59:59).</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-at_end_of_hour">at_end_of_hour</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-end_of_hour_source')" id="l_method-i-end_of_hour_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L122" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-end_of_hour_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 122</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">end_of_hour</span>
  <span class="ruby-identifier">change</span>(<span class="ruby-value">:min</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-number">59</span>, <span class="ruby-value">:sec</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-number">59</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-end_of_minute">
            
              <b>end_of_minute</b>()
            
            <a href="DateTime.html#method-i-end_of_minute" name="method-i-end_of_minute" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="DateTime.html">DateTime</a> representing the end of
the minute (hh:mm:59).</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-at_end_of_minute">at_end_of_minute</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-end_of_minute_source')" id="l_method-i-end_of_minute_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L134" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-end_of_minute_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 134</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">end_of_minute</span>
  <span class="ruby-identifier">change</span>(<span class="ruby-value">:sec</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-number">59</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-formatted_offset">
            
              <b>formatted_offset</b>(colon = true, alternate_utc_string = nil)
            
            <a href="DateTime.html#method-i-formatted_offset" name="method-i-formatted_offset" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>datetime = DateTime.civil(2000, 1, 1, 0, 0, 0, Rational(-6, 24))
datetime.formatted_offset         # =&gt; “-06:00”
datetime.formatted_offset(false)  # =&gt; “-0600”</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-formatted_offset_source')" id="l_method-i-formatted_offset_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/794a70f94485fb64ed1c49ba8532895306e2001c/activesupport/lib/active_support/core_ext/date_time/conversions.rb#L45" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-formatted_offset_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/conversions.rb, line 45</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">formatted_offset</span>(<span class="ruby-identifier">colon</span> = <span class="ruby-keyword">true</span>, <span class="ruby-identifier">alternate_utc_string</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">utc?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">alternate_utc_string</span> <span class="ruby-operator">||</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">TimeZone</span>.<span class="ruby-identifier">seconds_to_utc_offset</span>(<span class="ruby-identifier">utc_offset</span>, <span class="ruby-identifier">colon</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-future-3F">
            
              <b>future?</b>()
            
            <a href="DateTime.html#method-i-future-3F" name="method-i-future-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Tells whether the <a href="DateTime.html">DateTime</a> object’s datetime
lies in the future.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-future-3F_source')" id="l_method-i-future-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L26" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-future-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 26</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">future?</span>
  <span class="ruby-keyword">self</span> <span class="ruby-operator">&gt;</span> <span class="ruby-operator">::</span><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">current</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-getutc">
            
              <b>getutc</b>()
            
            <a href="DateTime.html#method-i-getutc" name="method-i-getutc" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-in">
            
              <b>in</b>(seconds)
            
            <a href="DateTime.html#method-i-in" name="method-i-in" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-in_time_zone">
            
              <b>in_time_zone</b>(zone = ::Time.zone)
            
            <a href="DateTime.html#method-i-in_time_zone" name="method-i-in_time_zone" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the simultaneous time in <code>Time.zone</code>.</p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span> = <span class="ruby-string">'Hawaii'</span>             <span class="ruby-comment"># =&gt; 'Hawaii'</span>
<span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>).<span class="ruby-identifier">in_time_zone</span>  <span class="ruby-comment"># =&gt; Fri, 31 Dec 1999 14:00:00 HST -10:00</span>
</pre>

<p>This method is similar to Time#localtime, except that it uses
<code>Time.zone</code> as the local zone instead of the operating system’s
time zone.</p>

<p>You can also pass in a TimeZone instance or string that identifies a
TimeZone as an argument, and the conversion will be based on that zone
instead of <code>Time.zone</code>.</p>

<pre class="ruby"><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>).<span class="ruby-identifier">in_time_zone</span>(<span class="ruby-string">'Alaska'</span>) <span class="ruby-comment"># =&gt; Fri, 31 Dec 1999 15:00:00 AKST -09:00</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-in_time_zone_source')" id="l_method-i-in_time_zone_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/794a70f94485fb64ed1c49ba8532895306e2001c/activesupport/lib/active_support/core_ext/date_time/zones.rb#L17" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-in_time_zone_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/zones.rb, line 17</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">in_time_zone</span>(<span class="ruby-identifier">zone</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">zone</span>
    <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">TimeWithZone</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">utc?</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">self</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">getutc</span>, <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">find_zone!</span>(<span class="ruby-identifier">zone</span>))
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-inspect">
            
              <b>inspect</b>()
            
            <a href="DateTime.html#method-i-inspect" name="method-i-inspect" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-default_inspect">default_inspect</a>
            </div>
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-midnight">
            
              <b>midnight</b>()
            
            <a href="DateTime.html#method-i-midnight" name="method-i-midnight" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-past-3F">
            
              <b>past?</b>()
            
            <a href="DateTime.html#method-i-past-3F" name="method-i-past-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Tells whether the <a href="DateTime.html">DateTime</a> object’s datetime
lies in the past.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-past-3F_source')" id="l_method-i-past-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L21" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-past-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 21</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">past?</span>
  <span class="ruby-keyword">self</span> <span class="ruby-operator">&lt;</span> <span class="ruby-operator">::</span><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">current</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-readable_inspect">
            
              <b>readable_inspect</b>()
            
            <a href="DateTime.html#method-i-readable_inspect" name="method-i-readable_inspect" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Overrides the default inspect method with a human readable one, e.g., “Mon,
21 Feb 2005 14:30:00 +0000”.</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-inspect">inspect</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-readable_inspect_source')" id="l_method-i-readable_inspect_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/794a70f94485fb64ed1c49ba8532895306e2001c/activesupport/lib/active_support/core_ext/date_time/conversions.rb#L50" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-readable_inspect_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/conversions.rb, line 50</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">readable_inspect</span>
  <span class="ruby-identifier">to_s</span>(<span class="ruby-value">:rfc822</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-seconds_since_midnight">
            
              <b>seconds_since_midnight</b>()
            
            <a href="DateTime.html#method-i-seconds_since_midnight" name="method-i-seconds_since_midnight" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Seconds since midnight: DateTime.now.seconds_since_midnight.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-seconds_since_midnight_source')" id="l_method-i-seconds_since_midnight_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L31" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-seconds_since_midnight_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 31</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">seconds_since_midnight</span>
  <span class="ruby-identifier">sec</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">min</span> * <span class="ruby-number">60</span>) <span class="ruby-operator">+</span> (<span class="ruby-identifier">hour</span> * <span class="ruby-number">3600</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-seconds_until_end_of_day">
            
              <b>seconds_until_end_of_day</b>()
            
            <a href="DateTime.html#method-i-seconds_until_end_of_day" name="method-i-seconds_until_end_of_day" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the number of seconds until 23:59:59.</p>

<pre class="ruby"><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2012</span>, <span class="ruby-value">8</span>, <span class="ruby-value">29</span>,  <span class="ruby-value">0</span>,  <span class="ruby-value">0</span>,  <span class="ruby-value">0</span>).<span class="ruby-identifier">seconds_until_end_of_day</span> <span class="ruby-comment"># =&gt; 86399</span>
<span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2012</span>, <span class="ruby-value">8</span>, <span class="ruby-value">29</span>, <span class="ruby-value">12</span>, <span class="ruby-value">34</span>, <span class="ruby-value">56</span>).<span class="ruby-identifier">seconds_until_end_of_day</span> <span class="ruby-comment"># =&gt; 41103</span>
<span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2012</span>, <span class="ruby-value">8</span>, <span class="ruby-value">29</span>, <span class="ruby-value">23</span>, <span class="ruby-value">59</span>, <span class="ruby-value">59</span>).<span class="ruby-identifier">seconds_until_end_of_day</span> <span class="ruby-comment"># =&gt; 0</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-seconds_until_end_of_day_source')" id="l_method-i-seconds_until_end_of_day_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L40" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-seconds_until_end_of_day_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 40</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">seconds_until_end_of_day</span>
  <span class="ruby-identifier">end_of_day</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">to_i</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-since">
            
              <b>since</b>(seconds)
            
            <a href="DateTime.html#method-i-since" name="method-i-since" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="DateTime.html">DateTime</a> representing the time a
number of seconds since the instance time. Do not use this method in
combination with x.months, use months_since instead!</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-in">in</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-since_source')" id="l_method-i-since_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L96" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-since_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 96</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">since</span>(<span class="ruby-identifier">seconds</span>)
  <span class="ruby-keyword">self</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Rational</span>(<span class="ruby-identifier">seconds</span>.<span class="ruby-identifier">round</span>, <span class="ruby-number">86400</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_default_s">
            
              <b>to_default_s</b>(format = :default)
            
            <a href="DateTime.html#method-i-to_default_s" name="method-i-to_default_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_f">
            
              <b>to_f</b>()
            
            <a href="DateTime.html#method-i-to_f" name="method-i-to_f" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts <code>self</code> to a floating-point number of seconds since the
Unix epoch.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_f_source')" id="l_method-i-to_f_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/794a70f94485fb64ed1c49ba8532895306e2001c/activesupport/lib/active_support/core_ext/date_time/conversions.rb#L73" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_f_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/conversions.rb, line 73</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_f</span>
  <span class="ruby-identifier">seconds_since_unix_epoch</span>.<span class="ruby-identifier">to_f</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_formatted_s">
            
              <b>to_formatted_s</b>(format = :default)
            
            <a href="DateTime.html#method-i-to_formatted_s" name="method-i-to_formatted_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Convert to a formatted string. See Time::DATE_FORMATS for predefined
formats.</p>

<p>This method is aliased to <code>to_s</code>.</p>

<h3 id="method-i-to_formatted_s-label-Examples">Examples</h3>

<pre class="ruby"><span class="ruby-identifier">datetime</span> = <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">2007</span>, <span class="ruby-value">12</span>, <span class="ruby-value">4</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>)   <span class="ruby-comment"># =&gt; Tue, 04 Dec 2007 00:00:00 +0000</span>

<span class="ruby-identifier">datetime</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">db</span>)            <span class="ruby-comment"># =&gt; &quot;2007-12-04 00:00:00&quot;</span>
<span class="ruby-identifier">datetime</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">db</span>)                      <span class="ruby-comment"># =&gt; &quot;2007-12-04 00:00:00&quot;</span>
<span class="ruby-identifier">datetime</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">number</span>)                  <span class="ruby-comment"># =&gt; &quot;20071204000000&quot;</span>
<span class="ruby-identifier">datetime</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">short</span>)         <span class="ruby-comment"># =&gt; &quot;04 Dec 00:00&quot;</span>
<span class="ruby-identifier">datetime</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">long</span>)          <span class="ruby-comment"># =&gt; &quot;December 04, 2007 00:00&quot;</span>
<span class="ruby-identifier">datetime</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">long_ordinal</span>)  <span class="ruby-comment"># =&gt; &quot;December 4th, 2007 00:00&quot;</span>
<span class="ruby-identifier">datetime</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">rfc822</span>)        <span class="ruby-comment"># =&gt; &quot;Tue, 04 Dec 2007 00:00:00 +0000&quot;</span>
</pre>

<h2 id="method-i-to_formatted_s-label-Adding+your+own+datetime+formats+to+to_formatted_s">Adding your own datetime formats to <a href="DateTime.html#method-i-to_formatted_s">#to_formatted_s</a></h2>

<p><a href="DateTime.html">DateTime</a> formats are shared with <a
href="Time.html">Time</a>. You can add your own to the Time::DATE_FORMATS
hash. Use the format name as the hash key and either a strftime string or
Proc instance that takes a time or datetime argument as the value.</p>

<pre class="ruby"><span class="ruby-comment"># config/initializers/time_formats.rb</span>
<span class="ruby-constant">Time</span><span class="ruby-operator">::</span><span class="ruby-constant">DATE_FORMATS</span>[:<span class="ruby-identifier">month_and_year</span>] = <span class="ruby-string">'%B %Y'</span>
<span class="ruby-constant">Time</span><span class="ruby-operator">::</span><span class="ruby-constant">DATE_FORMATS</span>[:<span class="ruby-identifier">short_ordinal</span>] = <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">time</span><span class="ruby-operator">|</span> <span class="ruby-identifier">time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-node">&quot;%B #{time.day.ordinalize}&quot;</span>) }
</pre>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-to_s">to_s</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_formatted_s_source')" id="l_method-i-to_formatted_s_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/794a70f94485fb64ed1c49ba8532895306e2001c/activesupport/lib/active_support/core_ext/date_time/conversions.rb#L31" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_formatted_s_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/conversions.rb, line 31</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_formatted_s</span>(<span class="ruby-identifier">format</span> = <span class="ruby-value">:default</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">formatter</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Time</span><span class="ruby-operator">::</span><span class="ruby-constant">DATE_FORMATS</span>[<span class="ruby-identifier">format</span>]
    <span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:call</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword">self</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">formatter</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">to_default_s</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_i">
            
              <b>to_i</b>()
            
            <a href="DateTime.html#method-i-to_i" name="method-i-to_i" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts <code>self</code> to an integer number of seconds since the Unix
epoch.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_i_source')" id="l_method-i-to_i_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/794a70f94485fb64ed1c49ba8532895306e2001c/activesupport/lib/active_support/core_ext/date_time/conversions.rb#L78" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_i_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/conversions.rb, line 78</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_i</span>
  <span class="ruby-identifier">seconds_since_unix_epoch</span>.<span class="ruby-identifier">to_i</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_s">
            
              <b>to_s</b>(format = :default)
            
            <a href="DateTime.html#method-i-to_s" name="method-i-to_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-to_default_s">to_default_s</a>
            </div>
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-utc">
            
              <b>utc</b>()
            
            <a href="DateTime.html#method-i-utc" name="method-i-utc" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Adjusts <a href="DateTime.html">DateTime</a> to UTC by adding its offset
value; offset is set to 0.</p>

<pre class="ruby"><span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">2005</span>, <span class="ruby-value">2</span>, <span class="ruby-value">21</span>, <span class="ruby-value">10</span>, <span class="ruby-value">11</span>, <span class="ruby-value">12</span>, <span class="ruby-constant">Rational</span>(<span class="ruby-value">-6</span>, <span class="ruby-value">24</span>))     <span class="ruby-comment"># =&gt; Mon, 21 Feb 2005 10:11:12 -0600</span>
<span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">civil</span>(<span class="ruby-value">2005</span>, <span class="ruby-value">2</span>, <span class="ruby-value">21</span>, <span class="ruby-value">10</span>, <span class="ruby-value">11</span>, <span class="ruby-value">12</span>, <span class="ruby-constant">Rational</span>(<span class="ruby-value">-6</span>, <span class="ruby-value">24</span>)).<span class="ruby-identifier">utc</span> <span class="ruby-comment"># =&gt; Mon, 21 Feb 2005 16:11:12 +0000</span>
</pre>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="DateTime.html#method-i-getutc">getutc</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-utc_source')" id="l_method-i-utc_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L143" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-utc_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 143</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">utc</span>
  <span class="ruby-identifier">new_offset</span>(<span class="ruby-number">0</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-utc-3F">
            
              <b>utc?</b>()
            
            <a href="DateTime.html#method-i-utc-3F" name="method-i-utc-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns <code>true</code> if <code>offset == 0</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-utc-3F_source')" id="l_method-i-utc-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L149" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-utc-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 149</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">utc?</span>
  <span class="ruby-identifier">offset</span> <span class="ruby-operator">==</span> <span class="ruby-number">0</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-utc_offset">
            
              <b>utc_offset</b>()
            
            <a href="DateTime.html#method-i-utc_offset" name="method-i-utc_offset" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the offset value in seconds.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-utc_offset_source')" id="l_method-i-utc_offset_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/6c61dbf1d222ae626203a3b7921dadcabb44e25f/activesupport/lib/active_support/core_ext/date_time/calculations.rb#L154" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-utc_offset_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 154</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">utc_offset</span>
  (<span class="ruby-identifier">offset</span> * <span class="ruby-number">86400</span>).<span class="ruby-identifier">to_i</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    